#!/bin/bash
str=`rados lspools`
str=${str//\n/ };

arr=($str);

for pool in ${arr[@]};do
	echo "----------------------"
        #echo "in pool  '$i' has "
	images=`rbd list $pool`
	#echo $images
	image_arr=($images);
	for image in ${image_arr[@]};do
		#	echo $j
		if [[ "$image" =~ .zk.backup$ ]]; then
			echo " the images is $image"
			rbd rm $image -p $pool
		fi
	done
done
